package com.epoint.mobileoa.personalized.epointcompany.adapter;

import java.util.List;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.personalized.epointcompany.model.MissionInfoModel;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


public class MissionInfoAdapter extends BaseAdapter {
	private LayoutInflater mInflater;
	List<MissionInfoModel> list;
	private SuperView sv;
	public MissionInfoAdapter(SuperView context, List<MissionInfoModel> list) {
		this.list = list;
		this.mInflater = LayoutInflater.from(context);
		sv = context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.epointxmlist, null);
			holder.ml_mailimg = (ImageView) convertView
					.findViewById(R.id.ml_mailimg);
			holder.ml_attach = (ImageView) convertView
					.findViewById(R.id.ml_attach);
			holder.ml_mailtitle = (TextView) convertView
					.findViewById(R.id.ml_mailtitle);
			holder.ml_sandt = (TextView) convertView
					.findViewById(R.id.ml_sandt);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		
		holder.ml_mailimg.setVisibility(View.GONE);
		holder.ml_mailtitle.setText(list.get(position).ProjectName);
		sv.setTextViewFontColor(holder.ml_mailtitle);
		holder.ml_sandt.setText(list.get(position).MissionName);
		return convertView;
	}

	public class ViewHolder {
		public ImageView ml_mailimg;
		public ImageView ml_attach;
		public TextView ml_mailtitle;
		public TextView ml_sandt;
	}
}